package com.itheima.controller;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.itheima.pojo.User;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;

@Controller
public class FirstController{
//	http://localhost:8080/Springmvc_Demo02//testdata
	@RequestMapping(value = "/testdata",method = RequestMethod.GET)
	@ResponseBody
	public String testdata(HttpServletRequest request) {
		String id=request.getParameter("id");
		System.out.println(id);
		return "success";
	}
	
	@RequestMapping("/login")
	public String login() {
		return "login";
	}
	
//	使用pojo
	@RequestMapping("/registerUser")
	public String register(User user) {
		System.out.println(user);
		return "success";
	}
}
